<template>
	<view class="main-container">
		<u-list @scrolltolower="scrolltolower">
			<u-sticky bgColor="#fff">
				<u-tabs :list="tabs" @click="clickTabs"></u-tabs>
				<u-notice-bar :text="text1" mode="closable"></u-notice-bar>
			</u-sticky>
			<u-list-item v-for="(item, index) in dataList" :key="index">
				<view class="item">
					<view class="item_top">
						<view class="item_title">
							<view v-if="report_type == 0">
								{{ item.laboratoryName }}
							</view>
							<view v-if="report_type == 1">
								{{ item.nameofPark }}
							</view>
							<view v-if="report_type == 2">
								{{ item.incubatorName }}
							</view>
							<view v-if="report_type == 3">
								{{ item.incubatorName }}
							</view>
							<view v-if="report_type == 4">
								{{ item.centerName }}
							</view>
							<view v-if="report_type == 5">
								{{ item.incubatorName }}
							</view>
							<view v-if="report_type == 6">
								{{ item.name }}
							</view>
							<view v-if="report_type == 7">
								{{ item.xmmc1 }}
							</view>
							<view v-if="report_type == 8">
								{{ item.xmmc1 || item.projectName }}
							</view>
							<view v-if="report_type == 9">
								{{ item.name }}
							</view>
							<view v-if="report_type == 10">
								{{ item.name }}
							</view>
							<view v-if="report_type == 11">
								{{ item.grxm }}
							</view>
							<view v-if="report_type == 12">
								{{ item.name }}
							</view>
							<view v-if="report_type == 13">
								{{ item.deptname }}
							</view>
							<view v-if="report_type == 14">
								{{ item.teamName }}
							</view>
						</view>
						<view class="item_status">
							<u-tag :text="item.tagName" plain size="mini" :type="item.tagType"></u-tag>
						</view>
					</view>
					<view class="item_bottom">
						<view class="declarant">
							{{ item.sbr }}
						</view>
						<view class="closing_date">
							{{ item.createTime }}
						</view>
					</view>
				</view>
			</u-list-item>
		</u-list>
	</view>
</template>

<script>
import * as report from '@/api/personCenter/index.js';
import * as data from '@/api/system/dict/data.js';
import * as newTeam from '@/api/source/kjrc/XSCDW.js';
import * as newYounger from '@/api/source/kjrc/QNXXTJB.js';
import * as enginner from '@/api/source/kjrc/ENGINNER.js';

//查询数据接口
import { listStpzdsys } from '@/api/innovate/stpzdsys'; //重点实验室
import { listStpkjyq } from '@/api/innovate/stpkjyq'; //科技园区
import { listStpfhq } from '@/api/innovate/stpfhq'; //孵化器
import { listStpxctd } from '@/api/innovate/stpxctd'; //星创天地
import { listStpgcjsyjzx } from '@/api/innovate/stpgcjsyjzx'; //工程技术研究中心
import { listStpzckj } from '@/api/innovate/stpzckj'; //众创空间
import { listStpcxtd } from '@/api/innovate/stpcxtd'; //创新团队
import { listKJJHXM } from '@/api/source/project/KJJHXM'; //科技项目
import { listKCJJ } from '@/api/source/project/KCJJ'; //科创基金
import { listTECH_PERSON } from '@/api/source/kjrc/TECH_PERSON'; //科技人才
import { listQNXXTJB } from '@/api/source/kjrc/QNXXTJB'; ////科技青年新星
import { listKJJJR } from '@/api/source/kjrc/KJJJR'; //科技经纪人
import { listXSCDW } from '@/api/source/kjrc/XSCDW'; //新双创队伍
import { listQypy } from '@/api/innovate/stqypy'; //企业培育
import { listXxyfjg } from '@/api/innovate/stpxxyfjg'; //新型研发机构
import { listEXPERT_BASIC1 } from '@/api/source/kjrc/EXPERT_BASIC'; //科技人才
import uniTag from '@/components/uni-tag/components/uni-tag/uni-tag.vue';
import uniGrid from '@/components/uni-grid/components/uni-grid/uni-grid.vue';
import uniGridItem from '@/components/uni-grid/components/uni-grid-item/uni-grid-item.vue';

import { codeList } from '@/utils/code';
import { defineComponent } from 'vue';
export default {
	components: {
		uniTag,
		uniGrid,
		uniGridItem
	},
	data() {
		return {
			text1: '列表详情请去web端查看！！！',
			tabs: [
				{
					name: '全部',
					value: null
				},
				{
					name: '未提交',
					value: '0',
					type: 'info'
				},
				{
					name: '已提交',
					value: '1',
					type: 'warning'
				},
				{
					name: '区级已审核',
					value: '2',
					type: 'primary'
				},
				{
					name: '市级已审核',
					value: '3',
					type: 'success'
				},
				{
					name: '已驳回',
					value: '4',
					type: 'error'
				}
			],
			report_type: '0',
			title: '',
			dataList: [],
			currentType: 0,
			query: {
				pageNum: 1,
				pageSize: '10',
				memberId: ''
			},
			serviceTypeList: [],
			statusList: [],
			total: 0,
			activeTabs: ''
		};
	},
	onLoad(option) {
		this.report_type = option.type;
		this.getUser();
		this.listOrder();
		// uni.showLoading({})
	},
	methods: {
		clickTabs(item) {
			this.dataList = [];
			this.query.pageNum = 1;
			this.activeTabs = item.value;
			this.listOrder(data);
		},
		getUser() {
			const value = uni.getStorageSync('userInfo');
			this.query.memberId = value.login_user.member.id;
		},
		scrolltolower() {
			if (this.dataList.length < this.total) {
				this.query.pageNum = this.query.pageNum + 1;
				this.listOrder();
			} else {
				uni.showToast({
					icon: 'none',
					title: '暂无更多数据！'
				});
			}
		},
		listOrder() {
			console.log(this.report_type);
			let data = {};
			if (this.activeTabs) {
				data.status = this.activeTabs;
			}
			data = { ...data, ...this.query };
			if (this.report_type == '0') {
				listStpzdsys(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '1') {
				listStpkjyq(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '2') {
				listStpfhq(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '3') {
				listStpxctd(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '4') {
				listStpgcjsyjzx(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '5') {
				listStpzckj(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '6') {
				listQypy(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '7') {
				listKJJHXM(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '8') {
				listKCJJ(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '9') {
				listEXPERT_BASIC1(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '10') {
				listQNXXTJB(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '11') {
				listKJJJR(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '12') {
				listXSCDW(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '13') {
				listXxyfjg(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			} else if (this.report_type == '14') {
				listStpcxtd(data).then((res) => {
					res.rows.forEach((v) => {
						v.createTime = v.createTime.substring(0, 10);
						v.tagType = this.tabs.find((item) => item.value === v.status).type;
						v.tagName = this.tabs.find((item) => item.value === v.status).name;
						this.dataList.push(v);
					});
					this.total = res.total;
				});
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.main-container {
	background-color: #e5e5e5;
	.item {
		background-color: #fff;
		border-radius: 16rpx;
		margin: 10rpx 20rpx;
		padding: 32rpx;
		color: #999;
		.item_top {
			display: flex;
			justify-content: space-between;
			margin-bottom: 30rpx;
			.item_title {
				color: #000;
				width: 70%;
			}
			.item_status{
			}
		}
		.item_bottom {
			display: flex;
			justify-content: space-between;
		}
	}
}
</style>
